package com.knife.easyexcel.read.message;


import com.knife.easyexcel.read.data.ImportDataWarp;

import java.util.List;
import java.util.StringJoiner;

/**
 * 默认的单条数据异常构造器，简单的1.xxx错误;2.aaa错误 样式
 *
 * @author Win10
 * @created 2024年12月19日 星期四 10:13
 */
public class DefaultImportValidatorErrorMsgBuilder<T> implements ImportValidatorErrorMsgBuilder<T>  {

    @Override
    public String build(ImportDataWarp<T> cuxImportDataWarp) {
        List<String> errorMsgList = cuxImportDataWarp.getErrorMsgList();
        StringJoiner stringJoiner = new StringJoiner(";");
        for (int i = 1; i <= errorMsgList.size(); i++) {
            stringJoiner.add(i + "." + errorMsgList.get(i - 1));
        }
        return stringJoiner.toString();
    }
}
